const mongoose = require('mongoose')
// mongoose.Promise = global.Promise
const DB_URL = 'mongodb://localhost/rent_crawler'
mongoose.connect(DB_URL)
// mongoose.connect('mongodb://localhost/rent_crawler', {
//     server: {poolSize: 5}
// })

let db = mongoose.connection
db.on('error', console.error.bind(console, 'Connection Error'));
db.on('openUri', function(){
    console.log('MongoDB Connection Established. ')
})

module.exports = db